﻿using System;
using System.Threading;
using System.Windows.Forms;
using AsynchronousCodeBlocks;
using log4net;

namespace Mistral.TestPoligon
{
	public partial class Form1 : Form
	{
		private static readonly ILog __log = LogManager.GetLogger( typeof ( Form1 ) );

		public Form1()
		{
			InitializeComponent();
		}
		private readonly Sonic.Net.ThreadPool _myThreadPool = new Sonic.Net.ThreadPool(5, 5);
		private void button1_Click(object sender, EventArgs e)
		{
			for(int i = 1; i <= 1000; i++ )
						{
							__log.InfoFormat( Thread.CurrentThread.ManagedThreadId+"string "+i );
						}
//			RunThread();
//			RunThread();
//			RunThread();
//			RunThread();
//			RunThread();
//			RunThread();
		}

		private void RunThread( )
		{
			new async(
				delegate
					{
						for(int i = 0; i < 100; i++ )
						{
							__log.InfoFormat( Thread.CurrentThread.ManagedThreadId+"string "+i );
							Thread.Sleep( 10 );
						}
					}, _myThreadPool );
		}

		private void Ad( )
		{
			
		}
	}
}
